<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    


	public function adminLogin(){
        $adminModel=M('admin');



        $adminname=$_POST['adminname'];
        $pass=md5($_POST['pass']);
        $admin=$adminModel->where("pass='".$pass."' AND name='".$adminname."' ")->select();
        if($admin){
            /*$this->success('','../Index/users');*/
            session('admin',$adminname);
            session('admin_id',$admin[0]['id']);
            $this->redirect('./Admin/Index/index');
        }else{
            $this->error("登录失败");
        }

    }
    public function adminExit()
    {
        session('admin',null); // 删除name
         $this->redirect('./Admin/Login/login');
    }

}